<?php

namespace App\Http\Model;

class GoodsComment extends Base {

    protected $hidden = [
        'goods_id', 'activity_id', 'is_active', 'sort_order', 'updated_at'
    ];

    protected $fillable = ['user_id', 'goods_id', 'content', 'is_active'];

    public function images()
    {
        return $this->hasMany('App\Http\Model\GoodsCommentImage');
    }

    public function user()
    {
        return $this->belongsTo('App\Http\Model\User');
    }

    public function getCreatedAtAttribute($date)
    {
        return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $date)->timestamp;
    }

    public function goods()
    {
        return $this->belongsTo('App\Http\Model\Goods');
    }
}



